// JavaScript Document
;
var appname={};
appname.ready=function(callback){
	if(document.addEventListener){
		document.addEventListener(
		    "DOMContentLoaded",
		    function(){
			   // document.removeEventListener("DOMContentLoaded",arguments.callee,false);
			    callback();
				console.log('removeEventListener');
				console.log(arguments.callee)
				
		    },
			false
		);
	}else if(document.attachEvent){
		document.attachEvent(
		    "onreadystatechange",
		    function(){
			    if ( document.readyState === "complete" ) {
				    document.detachEvent( "onreadystatechange", arguments.callee );
				    callback();
					console.log('detachEvent');
					//alert(arguments.callee)
			    }
		    }
		)
	 }
}
;

function CTRL(){}
 
    CTRL.fullscreen = function (divObj) {    
        if(typeof divObj=="undefined"){
            divObj=document.documentElement; 
        }
        if (divObj.requestFullscreen) {        
            divObj.requestFullscreen();        
        }
        else if (divObj.msRequestFullscreen) {
            divObj.msRequestFullscreen();        
        }
        else if (divObj.mozRequestFullScreen) {            
            divObj.mozRequestFullScreen();            
        }
        else if (divObj.requestFullscreen 
        || ('webkitRequestFullScreen' in document.documentElement) ) 
        {         
            try{
                     //支持谷歌
                     // 对 Chrome 特殊处理，
                     // 参数 Element.ALLOW_KEYBOARD_INPUT 使全屏状态中可以键盘输入。
                    if ( window.navigator.userAgent.toUpperCase().indexOf( 'CHROME' ) >= 0 ) {                        
                         divObj.webkitRequestFullScreen( Element.ALLOW_KEYBOARD_INPUT );                                          
                    }else{                        
                        divObj.webkitRequestFullscreen();
                        $.doll.throw("webkitRequestFullscreen()");
                    }
             }catch(e){
                 //支持 safari5.1  s大小写的区别
                 divObj.webkitRequestFullScreen();             
             }
        }
        else{                      
            alert("你的浏览器不支持全屏！");
        }    
        return;
      }
      
      
      CTRL.exitFullscreen = function () {
          
          try{
        if (document.exitFullscreen) {
          document.exitFullscreen();
        }
        else if (document.msExitFullscreen) {
          document.msExitFullscreen();
        }
        else if (document.mozCancelFullScreen) {
          document.mozCancelFullScreen();
        }
        else if (document.webkitCancelFullScreen) {
            console.log('webkitCancelFullScreen')
          document.webkitCancelFullScreen();
        }
       
          }catch(e){
            //console.error(e)  
          }
        return;
      };